/*************************************************************************
 *************************************************************************
 	 	 	 	 	 	 	M2SMA : M2SMA_EXCEPTIONS.h
 *************************************************************************
 *
 	 Copyright (C) 2011
 	 M2SMA enhanced core, Steven Costiou, France
 *
 **************************************************************************
 **************************************************************************
 *
	SPECIFIC EXCEPTIONS FOR M2SMA CORE CLASSES.
 *
 **************************************************************************
 **************************************************************************
 *
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/
 *
 **************************************************************************
 **************************************************************************/

#ifndef M2SMA_EXCEPTIONS_H_
#define M2SMA_EXCEPTIONS_H_

#include <stdexcept>

using namespace std;

class SchedulingModeException : public exception
{
	public:

	/**
	 * TODO
	 * Switcher les valeurs des scheduling mode pour imprimer les valeurs de l'enum intelligibles
	 */
		SchedulingModeException(int aSchedulingMode) { this->unknownSchedulingMode = aSchedulingMode; };
		const char* what() throw()
				{ cout << "Unknown or forbidden scheduling mode selected (" << this->unknownSchedulingMode << ")";
				  return "UNKNOWN OR FORBIDDEN SCHEDULING MODE"; };

	private:

		int unknownSchedulingMode;

};

class ForbiddenSchedulingModeException : public exception
{
	/**
	 * TODO
	 * Switcher les valeurs des scheduling mode pour imprimer les valeurs de l'enum intelligibles
	 */
	public:

		ForbiddenSchedulingModeException(int aSchedulingMode) { this->unauthorizedSchedulingMode = aSchedulingMode; };
		const char* what() throw()
				{ cout << "Forbidden scheduling mode selected (" << this->unauthorizedSchedulingMode << ")";
				  return "FORBIDDEN SCHEDULING MODE"; };

	private:
		int unauthorizedSchedulingMode;
};

class missingEngineAtAgentCreationException : public exception
{
	public:

		missingEngineAtAgentCreationException() {};
		const char* what() throw()
				{  return "AGENT CREATED WITHOUT CONTEXT - NO ASSOCIATED ENGINE"; };
};

class UnknownSchedulingPriorityException : public exception
{
	public:
	/**
	 * TODO
	 * Switcher les valeurs des scheduling mode pour imprimer les valeurs de l'enum intelligibles
	 */
		UnknownSchedulingPriorityException(int anUnknownPriority) { this->unknownPriority = anUnknownPriority; };
		const char* what() throw()
				{ cout << "Unknown scheduling priority selected (" << this->unknownPriority << ")";
				  return "UNKNOWN SCHEDULING PRIORITY SELECTED"; };

	private:
		int unknownPriority;
};

class UnknownAgentDeletionException : public exception
{
	public:

		UnknownAgentDeletionException(const char* aName) { this->agentName = aName; };
		const char* what() throw()
				{ cout << "Unknown agent " << this->agentName << " submitted to deletion.";
				  return "UNKNOWN AGENT SUBMITTED TO DELETION"; };

	private:
		const char* agentName;
};

#endif /** M2SMA_EXCEPTIONS_H_ **/
